<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./vuev2.5.21.js"></script>
</head>
<body>
    <div id="app">
      <div>
          <label>id:
              <input type="text" v-model="id"> 
          </label>
          <label>name:
              <input type="text" v-model="name"> 
          </label>
          <input type="button" value="添加" @click="add">
      </div>
      <p v-for="item in list" :key="item.name">
          <input type="checkbox">
          {{item.id}} at {{item.name}}
      </p> 
    </div>
    <script>
      new Vue({
        el:"#app",
        data:{
          id:"",
          name:"",
          list:[
            {id:1,name:"李斯"},
            {id:2,name:"嬴政"},
            {id:3,name:"超高"},
          ]
        },
        methods:{
          add(){
            // this.list.push({id:this.id,name:this.name})
            this.list.unshift({id:this.id,name:this.name})
          }
        }
      })
    </script>
</body>
</html>